﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

#endregion

namespace ScrumTable.UI.View.Converter
{

    public enum ResolutionType
    {
        Horizontal,
        Vertical

    }
    /// <summary>
    /// 
    /// </summary>
    [ValueConversion(typeof(double), typeof(double))]
    public class ConverterResolution : IValueConverter
    {

        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------
        private const double Vertical = 1050;
        private const double Horizontal = 1680;
        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------
        public ResolutionType ResolutionType { get; set; }
        public double BasisValue { get; set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        public ConverterResolution()
        {
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------
        /// <summary>
        /// Converts a value into an other value based on the new resulation. 
        /// </summary>
        /// <param name="value">The bool value produced by the binding source.</param>
        /// <param name="targetType">The type of the binding target property.</param>
        /// <param name="parameter">The converter parameter to use.</param>
        /// <param name="culture">The culture to use in the converter.</param>
        /// <returns>
        /// </returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (ResolutionType == ResolutionType.Horizontal)
            {
                return BasisValue*(SystemParameters.PrimaryScreenWidth/Horizontal);
            }
            else
            {
                return BasisValue*(SystemParameters.PrimaryScreenWidth/Vertical);
            }
        }

        /// <summary>
        /// Not supported. Throws NotSupportedException.
        /// </summary>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();

        }
       
        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion

       
    }
}

